from django.db import models
import django.utils.timezone as timezone
from django.db import models
from django.utils.encoding import smart_str


class addTeamMembers(models.Model):
    name = models.CharField(verbose_name="姓名",max_length=30)
    sex = models.IntegerField(verbose_name="性别",choices=((1,"男"),(2,"女")),default=1)
    college_name = models.CharField(verbose_name="学院",max_length=40)
    major_name = models.CharField(verbose_name="专业",max_length=40)
    class_name = models.CharField(verbose_name="班级", max_length=40)
    class_monitor = models.IntegerField(verbose_name="是否班委", choices=((0, "不是"), (1, "是")), default=0)
    phone_number = models.CharField(verbose_name="手机号", max_length=20, default="init")
    email = models.CharField(verbose_name="邮箱", max_length=36, default="init")
    access_times = models.IntegerField(verbose_name="访问次数", default=1)
    update_time = models.CharField(verbose_name="最后访问时间", max_length=40, default="2020-01-01")

    def __str__(self):
        return smart_str('%s-%s' % (self.name, self.major_name))

    class Meta:
        db_table = "member_addition"
        verbose_name = '成员添加'
        verbose_name_plural = '成员添加'

    @property
    def is_authenticated(self):
        """
        Always return True. This is a way to tell if the user has been
        authenticated in templates.
        """
        return True
class addAwardInformation(models.Model):

    project_name = models.CharField(verbose_name="项目名称",max_length=40)
    project_head = models.CharField(verbose_name="项目负责人", max_length=40)
    prize_name = models.CharField(verbose_name="奖项名称", max_length=40)
    prize_level = models.IntegerField(verbose_name="奖项级别",choices=((1,"一等奖"),(2,"二等奖"),(3,"三等奖")),default=1)
    prize_time = models.TimeField(verbose_name="获奖时间",auto_now_add=True)
    group_members = models.TextField(verbose_name="小组成员",max_length=50)
    project_overview = models.TextField(verbose_name="项目概述",max_length=60)

    def __str__(self):
        return smart_str('%s-%s' % (self.project_name, self.prize_time))
    class Meta:
        db_table = "awards_addition"
        verbose_name = '获奖添加'
        verbose_name_plural = '奖项添加'

    @property
    def is_authenticated(self):
        """
        Always return True. This is a way to tell if the user has been
        authenticated in templates.
        """
        return True